home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Internet / WWW / fly / examples / size < prev    next >
Encoding:
Text File  |  1996-01-09  |  540 b   |  31 lines

  1. #!/usr/local/bin/perl
  2. #
  3. #  Simple script using fly to find the dimensions of an image.
  4. #
  5. #  Martin Gleeson, January 1996
  6. #
  7.  
  8. if( ! $ARGV[0] )
  9. {
  10.         print STDERR "Usage: size <GIF image>\n";
  11.         exit(0);
  12. }
  13.  
  14. open(FLY,"> /tmp/fly.$$");
  15. print FLY "existing $ARGV[0]\n";
  16. print FLY "sizex\n";
  17. print FLY "sizey\n";
  18. close(FLY);
  19.  
  20. open(OUT, "fly -i /tmp/fly.$$ -o /dev/null |");
  21.  
  22. while( <OUT> )
  23. {
  24.       ($x) = /is\ (\d+)$/ if /Size\ -\ X/;
  25.       ($y) = /is\ (\d+)$/ if /Size\ -\ Y/;
  26. }
  27.  
  28. close(OUT);
  29.  
  30. print "Dimensions of $ARGV[0]: $x by $y\n";
  31.